#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Created on 7/17/13
"""
from django.contrib import admin
from models import Author, Book, Publisher
__author__ = 'honghe'

class AuthorAdmin(admin.ModelAdmin):
    list_display = ('first_name', 'last_name', 'email')
    search_fields = ('first_name', 'last_name')

class BookAdmin(admin.ModelAdmin):
    list_display = ('title', 'publisher', 'publication_date')
    list_filter = ('publication_date', 'publisher')
    date_hierarchy = 'publication_date'
    ordering = ('title',)
    fields = ('title', 'authors', 'publisher', 'publication_date')
    filter_horizontal = ('authors',)
    raw_id_fields = ('publisher',)

admin.site.register(Author, AuthorAdmin)
admin.site.register(Book, BookAdmin)
admin.site.register(Publisher)